<template>
  <div class="register">
    <div class="title">
      <span class="left">电商可视化平台   注册</span>
      <span class="right">加入我们：2517026539@qq.com</span>
    </div>
    <div class="content">
      <ul>
        <li>
          <el-input
            placeholder="用户名"
            type="text"
            v-model="userName"
            class="input"
          >
          </el-input>
        </li>
        <li>
          <el-input
            placeholder="密码"
            v-model="userPass"
            show-password
            class="input"
          >
          </el-input>
        </li>
        <li>
          <el-button type="primary" class="submit" @click="register">注 册</el-button>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
  import {register} from './../api/api'
    export default {
        name: "register",
        data(){
          return {
            userName: '',
            userPass: ''
          }
        },
        methods: {
          register: function () {
            if (this.userName === '' || this.password === '') {
              return this.$message({
                type: 'warning',
                message: '密码或账号不能为空'
              });
            }
            const userData = {
              userName: this.userName,
              password: this.password
            };
            //向后台发送注册请求
            this.$router.push({path: '/login'});
          }
        }
    }
</script>

<style lang="scss" scoped>
  @import './../assets/css/public/public';
  @import './../assets/css/register/register';
</style>
